package zhang.lao.console.controller.wn;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import zhang.lao.annotation.RepeatSubmit;
import zhang.lao.pojo.console.ConsoleContext;
import zhang.lao.pojo.console.req.BootStrapGridReq;
import zhang.lao.pojo.console.resp.BootStrapGridResp;
import zhang.lao.pojo.console.resp.HttpResult;
import zhang.lao.service.console.base.WnFarmService;
import javax.annotation.Resource;
/**
* 农场信息
* @author ZhangQin
* @create 2017年08月28日 17:02
**/
@Controller
public class WnFarmController{
	@Resource
	private WnFarmService wnFarmService;

	@RequestMapping("/console/wn_farm/add")
	@RepeatSubmit(isAdd = true)
	public String add(){
		return wnFarmService.add();
	}

	@RepeatSubmit(isAdd = true)
	@RequestMapping("/console/wn_farm/edit")
	public String edit(ModelMap modelMap,String id){
		return  wnFarmService.edit(modelMap,id);
	}

	@RequestMapping("/console/wn_farm/list")
	public String list(){
		return  wnFarmService.list();
	}

	@RequestMapping("/console/wn_farm/json")
	public @ResponseBody BootStrapGridResp json(BootStrapGridReq bootGridReq,ConsoleContext consoleContext){
		return wnFarmService.json(bootGridReq,consoleContext);
	}

	@RepeatSubmit(isAdd = false)
	@RequestMapping("/console/wn_farm/save")
	public @ResponseBody HttpResult save(String formObjectJson, ConsoleContext consoleContext){
		return wnFarmService.save(formObjectJson,consoleContext);

	}

	@RequestMapping("/console/wn_farm/delete")
	public @ResponseBody HttpResult delete(String ids){
        return wnFarmService.delete(ids);
	}
}
